<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<HEAD>
    <TITLE>租房 -发布房屋信息</TITLE>
    <META content="text/html; charset=utf-8" http-equiv=Content-Type>
    <LINK rel=stylesheet type=text/css href="${pageContext.request.contextPath}/css/style.css">
    <META name=GENERATOR content="MSHTML 8.00.7601.17514">
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jQery-3.6.0.min.js" charset="UTF-8"></script>
</HEAD>
<BODY>
<DIV id=header class=wrap>
    <DIV id=logo><IMG src="${pageContext.request.contextPath}/images/logo.gif"></DIV></DIV>
<DIV id=regLogin class=wrap>
    <DIV class=dialog>
        <DL class=clearfix>
            <DT>新房屋信息发布</DT>
            <DD class=past>填写房屋信息</DD></DL>
        <DIV class=box>
            <FORM id=add_action method="post" name=add.action
                  action="publishRent.do" >
                <DIV class=infos>
                    <TABLE class=field>
                        <TBODY>
                        <TR>
                            <TD class=field>标　　题：</TD>
                            <TD><INPUT id=add_action_title class=text type=text name="title"> </TD></TR>
                        <TR>
                            <TD class=field>户　　型：</TD>
                            <TD>
                                <SELECT class=text id="typeId" name="typeId">
                                    <OPTION selected value=1000>一室一厅</OPTION>
                                </SELECT>
                            </TD>
                        </TR>
                        <TR>
                            <TD class=field>面　　积：</TD>
                            <TD>
                                <INPUT id=add_action_floorage class=text type=text  name=area>
                            </TD>
                        </TR>
                        <TR>
                            <TD class=field>价　　格：</TD>
                            <TD><INPUT id=add_action_price class=text type=text name="price"> </TD></TR>
                        <TR>
                            <TD class=field>房产证日期：</TD>
                            <TD><INPUT class=text type=text name="houseDate"></TD></TR>
                        <TR>
                            <TD class=field>位　　置：</TD>
                            <TD>区：
                                <SELECT class=text id="district" name="districtId">
                                        <OPTION selected value=1001>东城区</OPTION>
                                </SELECT>街：
                                <SELECT class=text id="streetId" name="streetId">
                                    <OPTION selected value=1001>中关村大街</OPTION>
                                </SELECT>
                            </TD>
                        </TR>
                        <TR>
                            <TD class=field>联系方式：</TD>
                            <TD><INPUT id=add_action_contact class=text type=text name="contact"> </TD></TR>
                        <TR>
                            <TD class=field>详细信息：</TD>
                            <TD><TEXTAREA name="descp"></TEXTAREA>
                            </TD>
                        </TR>
                        <TR>
                            <TD><INPUT   class=text type="hidden" name="nickName" value="${nickName}"> </TD>
                        </TR>
                        </TBODY>
                    </TABLE>
                    <DIV class="buttons">
                        <INPUT  value=立即发布 type="submit">
                    </DIV>
                </DIV>
            </FORM>
        </DIV>
    </DIV>
</DIV>
<DIV id=footer class=wrap>
    <DL>
        <DT>租房 © 2010  京ICP证1000001号</DT>
        <DD>关于我们 · 联系方式 · 意见反馈 · 帮助中心</DD>
    </DL>
</DIV>
</BODY>
<script>
    $(function (){
       getType();
       getDistrict();
    });
    $("#district").change(function (){
        let id = $('#district').val();
        let value =  parseInt(id);
        $.ajax({
            type:"post",
            url:"getStreet.do",
            data:{districtId:value},
            success:function (data){
                $('#streetId').empty();
                var str ='';
                for( let i in data){
                    str += '<option value="'+ data[i].streetId +'">'+data[i].streetName+'</option>';
                }
                $('#streetId').append(str);
            }
        })
    });
    function getType() {
        $.ajax({
            type:"post",
            url:"getType.do",
            success:function (data){
                $('#typeId').empty();
                var str ='';
                for( let i in data){
                    str += '<option value="'+ data[i].typeId +'">'+data[i].typeName+'</option>';
                }
                $('#typeId').append(str);
            }
        })
    }
    function getDistrict() {
        $.ajax({
            type:"post",
            url:"getDistrict.do",
            success:function (data){
                $('#district').empty();
                var str ='';
                for( let i in data){
                    str += '<option value="'+ data[i].districtId +'">'+data[i].districtName+'</option>';
                }
                $('#district').append(str);
            }
        })
    }

</script>
</HTML>
